package com.gitee.feizns.itrip.personal.biz.service.impl;

import com.gitee.feizns.itrip.personal.biz.entity.vo.ForViewGetImg;
import com.gitee.feizns.itrip.personal.biz.entity.vo.ForViewGetVideoDesc;
import com.gitee.feizns.itrip.personal.biz.entity.vo.ForViewHotelDesc;
import com.gitee.feizns.itrip.personal.biz.entity.vo.ForViewHotelLable;
import com.gitee.feizns.itrip.personal.biz.entity.vo.ForViewQueryHotelDetails;
import com.gitee.feizns.itrip.personal.biz.entity.vo.ForViewQueryTradeArea;
import com.gitee.feizns.itrip.personal.biz.mapper.BizAreaDicMapper;
import com.gitee.feizns.itrip.personal.biz.mapper.BizHotelMapper;
import com.gitee.feizns.itrip.personal.biz.mapper.BizImageMapper;
import com.gitee.feizns.itrip.personal.biz.mapper.BizLabelDicMapper;
import com.gitee.feizns.itrip.personal.biz.service.HotelService;
import com.gitee.feizns.itrip.personal.mapper.ImageMapper;
import com.gitee.feizns.itrip.personal.mapper.LabelDicMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author feizns
 * @since 2019/1/8 0008
 */
@Service
public class HotelServiceImpl implements HotelService {

    @Autowired
    private BizAreaDicMapper areaDicMapper;

    @Autowired
    private BizHotelMapper hotelMapper;

    @Autowired
    private BizLabelDicMapper bizLabelDicMapper;

    @Autowired
    private BizImageMapper bizImageMapper;

    @Override
    public List<ForViewQueryTradeArea> queryHotCity(Integer isChina) {
        return areaDicMapper.selectByIsChina(isChina, DEFAULT_HOT_HOTEL_SIZE);
    }

    @Override
    public List<ForViewQueryTradeArea> queryTradeArea(Integer parent) {
        return areaDicMapper.selectByParent(parent);
    }

    @Override
    public ForViewGetVideoDesc getVideoDesc(Integer hotelId) {
        return hotelMapper.selectVideoDescByHotelId(hotelId);
    }

    @Override
    public List<ForViewQueryHotelDetails> queryHotelDetails(Integer hotelId) {
        return hotelMapper.queryHotelDetails(hotelId);
    }

    @Override
    public String queryHotelFacilities(Integer hotelId) {
        return hotelMapper.selectHotelFacilitiesByHotelId(hotelId);
    }

    @Override
    public String queryHotelPolicy(Integer hotelId) {
        return hotelMapper.selectHotelPolicyByHotelId(hotelId);
    }

    @Override
    public ForViewHotelDesc getHotelDesc(Integer hotelId) {
        return hotelMapper.getHotelDesc(hotelId);
    }

    @Override
    public List<ForViewHotelLable> queryHotelFeature() {
        return bizLabelDicMapper.selectByParentId(LabelDicMapper.HOTEL_FEATURE);
    }

    @Override
    public List<ForViewGetImg> getImage(Integer hotelId) {
        return bizImageMapper.getImg(ImageMapper.IMG_HOTEL_TYPE, hotelId);
    }

}
